// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
import { message } from 'ant-design-vue'
Vue.use(Antd)
Vue.config.productionTip = false
router.beforeEach((to,from,next)=>{
  if(to.path == '/login' || to.path == '/register'){
    localStorage.setItem('token',null)
    next();
  }else{
    if(localStorage.getItem('token')=="null" || localStorage.getItem('token')==null){
      message.error('请先登录')
      next('/login');
    }else{
      next()
    }
    
  }
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
